fix(vscode): speed up bash tool card rendering - #14007
Merged
Merged
Conversation
BasicTool read the children getter several times per render, and the Kilo wrapper rebuilt its details subtree on every read. One bash card therefore constructed three BashHighlightedOutput instances. Memoize the subtree so repeated reads reuse a single instance.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Previous Review Summary (commit 546321e)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 546321e)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by grok-4.6 · Input: 52.2K · Output: 8.6K · Cached: 369.3K Review guidance: REVIEW.md from base branch |
createMemo evaluates eagerly, which built the body of a collapsed deferred tool and broke the board tool transcript deferred-body contract. Only memoize eager tools; deferred tools keep the lazy accessor so Base still gates the body on ready().
marius-kilocode
enabled auto-merge
September 10, 2026 11:54
WebReflection
approved these changes
Sep 10, 2026
This was referenced Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Expanded bash tool cards in the VS Code chat webview did redundant work on every render. Each card constructed its output body (command and output, including Shiki highlight setup) three times instead of once.
Why This Change Was Made
packages/uiBasicToolreads itschildrengetter in several places while laying out the tool:hasChildren(), the trigger details condition, and both alternates of the animated and non-animated content branches. The Kilo wrapper inpackages/kilo-uibuilt its<div data-slot="basic-tool-details">subtree inside an unmemoized accessor, so every bare read rebuilt the whole subtree. Component instrumentation on a bash card logged threeBashHighlightedOutputinstances created with no cleanup.The fix memoizes the details subtree for eager tools, so repeated reads reuse one instance.
createMemoruns eagerly, so deferred tools keep the plain lazy accessor: otherwise a collapsed deferred card (for example a board tool) would build its body before it opens. The sharedpackages/uifile is untouched.User Impact
Expanded bash tool cards render faster in the VS Code chat webview. Visible behavior is unchanged: collapsed state, expansion, live streaming output, collapse and re-expand, Shiki highlighting, and deferred collapsed bodies.
Performance measurements
Reference benchmark harness on the bash card, 60 lines of shell output,
BENCH_MODE=append BENCH_TOOLS=bash BENCH_REPEATS=7, viewport 420x720, Chromium, harness-suppressed animations.Interleaved A/B runs toggled only the memo on and off with the same code and a fresh browser context per sample. The settle tail is the deferred Shiki path (shared highlighter load plus a queued task per block) and is not addressed by this change. A startup grammar preload was measured at only 6 to 13 percent on highlight latency and was not kept.
Validation
packages/kilo-vscode:bun run typecheckandbun run lintpass.packages/kilo-vscode:board-tool-render.test.tspasses (deferred collapsed bodies stay unbuilt), plus the focused unit test.packages/kilo-ui:basic-tool.test.tspasses.Changelog
Added
.changeset/bash-tool-render-sync.md(patch): speed up rendering of expanded bash tool cards in the VS Code chat webview.Limitations
settleP95Msas the max of samples, not a true percentile, and before and after overlap there.